package app.r_teenus.backend.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "SERVICE_DEVICE")
public class ServiceDevice implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5415290878525071919L;
	private Integer id = null;
	private ServiceDeviceStatusType serviceDeviceStatusType = null;
	private Device device = null;
	private ServiceOrder serviceOrder = null;
	private Date toStore = null;
	private Date fromStore = null;
	private String description = null;
	private Date statusChanged = null;
	private Integer status = null;
	private List<Device> deviceList = new ArrayList<Device>();
	
	/**
	 * Gets id (primary key).
	 */
	@Id
	@Column(name = "SERVICE_DEVICE")
	@SequenceGenerator(name = "service_device_id", sequenceName = "service_device_id", allocationSize = 1)
	@GeneratedValue(generator = "service_device_id")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@OneToOne
	@JoinColumn(name = "SERVICE_DEVICE_STATUS_TYPE_FK", nullable = false)
	public ServiceDeviceStatusType getServiceDeviceStatusType() {
		return serviceDeviceStatusType;
	}

	public void setServiceDeviceStatusType(ServiceDeviceStatusType serviceDeviceStatusType) {
		this.serviceDeviceStatusType = serviceDeviceStatusType;
	}

	@OneToOne
	@JoinColumn(name = "DEVICE_FK", nullable = false)
	public Device getDevice() {
		return device;
	}

	public void setDevice(Device device) {
		this.device = device;
	}

	@OneToOne
	@JoinColumn(name = "SERVICE_ORDER_FK", nullable = false)
	public ServiceOrder getServiceOrder() {
		return serviceOrder;
	}

	public void setServiceOrder(ServiceOrder serviceOrder) {
		this.serviceOrder = serviceOrder;
	}

	@Column(name = "TO_STORE")
	public Date getToStore() {
		return toStore;
	}

	public void setToStore(Date toStore) {
		this.toStore = toStore;
	}

	@Column(name = "FROM_STORE")
	public Date getFromStore() {
		return fromStore;
	}

	public void setFromStore(Date fromStore) {
		this.fromStore = fromStore;
	}

	@Column(name = "SERVICE_DESCRIPTION")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "STATUS_CHANGED")
	public Date getStatusChanged() {
		return statusChanged;
	}

	public void setStatusChanged(Date statusChanged) {
		this.statusChanged = statusChanged;
	}

	@Column(name = "STORE_STATUS")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Transient
	public List<Device> getDeviceList() {
		return deviceList;
	}

	public void setDeviceList(List<Device> deviceList) {
		this.deviceList = deviceList;
	}

	
	
}
